<%@ page language="java" contentType="text/html; charset=UTF-8"
pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basepath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<!DOCTYPE html>
<html>
<head lang="en">
    <meta charset="UTF-8">
    <title>上传头像</title>
    <meta content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0" name="viewport" />
    <meta content="black" name="apple-mobile-web-app-status-bar-style" />
    <meta content="telephone=yes" name="format-detection" />
    <link href="<%=basepath%>css/index.css" rel="stylesheet" type="text/css">
    <script src="<%=basepath%>js/jquery-1.8.3.min.js"></script>
    <script src="<%=basepath%>js/layer/layer.js"></script>
    <script src="<%=basepath%>js/upload.js"></script>
    <style type="text/css">
         body{background-color:#000;}
         .content{margin-top:48px;width:100%;}
         .blank{width:100%;height:50px;}
         .ua-1{width:100%;height:350px;overflow:hidden;}
         .ua-1 img{width:100%;cursor: pointer;}
         .ua-2{margin:0 auto;width:90%;height:50px;line-height:50px;}
         .file{width:80px;}
         .file input{opacity: 0;}
    </style>
</head>
<body>
<div class="viewport">
    <div class="header">
       <div class="header-1">
           <a href="javascrpt:void(0)" id="join" class="header-2">
              <span id="account" class="account">${empty user.realName ? '' : user.realName}</span>&nbsp;&nbsp;<span id="deptName" class="deptName">${user.departmentName}</span>
           </a>
           <a href="/wape-web/api/core/centerService?serviceCode=WJ9999&targetURL=mine&prefix=3g_mine&entrance=yes" class="back" id="back">返回</a>
           <span class="span-num"></span>
       </div>
    </div>
    <div class="content">
        <form method="post" id="myForm" action="/wape-web/api/core/centerService">
        <div class="ua-2">
           <input type="button" name="" id="upload" value="上传头像">
           <input type="file" name="" id="up" >
        </div>
        <div class="ua-1">
            <img src="${empty user.thumbnail ? '../../images/tou.png' : user.thumbnail}" alt="头像" id="ImgPr">
        </div>
        <script type="text/javascript">
            $("#up").uploadPreview({ Img: "ImgPr", Width: 120, Height: 120 });
        </script>
        </form>
    </div>
</div>
</body>
<script type="text/javascript">
    $(function(){
    	/*提交*/
        $(function(){
        	$("#upload").click(function(){
           		$("#myForm").submit();
           	 });
        });
        /*提交表单*/
        $("#myForm").submit(function(){
            var deposit = $("#deposit").val();
            if(deposit == ""){
                layer.msg("请输入定金",{shadeClose:true,shade:0.1,time:2000});
                return false;
            }
            else{
                layer.load();
                setTimeout(function(){
                    layer.closeAll();
                    layer.msg("网络异常，请重新尝试！",{shadeClose:true,shade:0.1,time:2000});
                }, 30000);
            }
        });
    });
</script>
</html>
